﻿using DtoFw;
using DtoFw.Common.Dto;
using DtoFw.Common.Query;
using DtoFw.Query;
using DtoFw.Statistics.Dto;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SceneEvidenceAPI.Controllers
{
    /// <summary>
    /// 统计控制器
    /// </summary>
    [Route("api/statistics")]
    public class StatisticsController : BaseController
    {
        private readonly StatisticsService _statisticsService;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="statisticsService"></param>
        public StatisticsController(StatisticsService statisticsService)
        {
            this._statisticsService = statisticsService;
        }

        /// <summary>
        /// 查询单位树状对象
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("organ")]
        public BaseGenericResult<OrganTreeDto> GetOrganTree(CommonQuery query)
        {
            return _statisticsService.GetOrganTree(query);
        }


        /// <summary>
        /// 物品状态统计
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("estatus")]
        public BaseGenericResult<List<EvidenceStatusDto>> StatisticsEvidenceStatus(CommonQuery query)
        {
            return _statisticsService.StatisticsEvidenceStatus(query);
        }

        /// <summary>
        /// 案件数量统计
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("case")]
        public BaseGenericResult<List<EvidenceStatusDto>> StatisticsCase(CommonQuery query)
        {
            return _statisticsService.StatisticsCase(query);
        }

        /// <summary>
        /// 物品数量统计
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("evidence")]
        public BaseGenericResult<List<EvidenceStatusDto>> StatisticsEvidence(CommonQuery query)
        {
            return _statisticsService.StatisticsEvidence(query);
        }

        /// <summary>
        /// 库区数量统计
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("room")]
        public BaseGenericResult<List<StatisticsRoomDto>> StatisticsRoom(CommonQuery query)
        {
            return _statisticsService.StatisticsRoom(query);
        }

        /// <summary>
        /// 区域下拉框数据
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("area")]
        public BaseGenericResult<List<AreaDto>> StatisticsAreaDic(CommonQuery query)
        {
            return _statisticsService.StatisticsAreaDic(query);
        }


        /// <summary>
        /// 物品状态统计/实战分析
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("analysis/estatus")]
        public BaseGenericResult<List<EvidenceStatusDto>> AnalysisEvidenceStatus(CommonQuery query)
        {
            return _statisticsService.AnalysisEvidenceStatus(query);
        }

        /// <summary>
        /// 物品类别统计/实战分析
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("analysis/class")]
        public BaseGenericResult<List<EvidenceStatusDto>> AnalysisEvidenceClass(CommonQuery query)
        {
            return _statisticsService.AnalysisEvidenceClass(query);
        }

        /// <summary>
        /// 物品来源统计/实战分析
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("analysis/source")]
        public BaseGenericResult<List<EvidenceStatusDto>> AnalysisEvidenceSource(CommonQuery query)
        {
            return _statisticsService.AnalysisEvidenceSource(query);
        }


        /// <summary>
        /// 提取部位统计/实战分析
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("analysis/parts")]
        public BaseGenericResult<List<EvidenceStatusDto>> AnalysisExtractionParts(CommonQuery query)
        {
            return _statisticsService.AnalysisExtractionParts(query);
        }

        /// <summary>
        /// 提取方法统计/实战分析
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("analysis/method")]
        public BaseGenericResult<List<EvidenceStatusDto>> AnalysisExtractMethod(CommonQuery query)
        {
            return _statisticsService.AnalysisExtractMethod(query);
        }

        /// <summary>
        /// 物品库房统计/实战分析
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost("analysis/room")]
        public BaseGenericResult<List<StatisticsRoomDto>> AnalysisRoom(CommonQuery query)
        {
            return _statisticsService.AnalysisRoom(query);
        }


    }
}
